package com.battery.controller;

import com.battery.pojo.Deposite_Order;
import com.battery.service.Deposite_OrderService;
import com.battery.util.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@Controller
@Api(tags = "押金订单相关接口")
public class Deposite_OrderController {
    @Autowired
    Deposite_OrderService deposite_OrderService;
    @PostMapping("/insertDeposite_Order")
    @ApiOperation("生成押金订单")
    public Result insertDeposite_Order(@RequestBody @ApiParam(name="押金订单对象",value="传入json格式",required=true) Deposite_Order deposite_Order) {
        return deposite_OrderService.addDeposite_Order(deposite_Order);
    }

    @GetMapping("/queryDeposite_Order/{deposite_Order_id}")
    @ApiOperation("根据押金订单id查询押金订单")
    public Result queryDeposite_OrderById(@ApiParam(name="押金订单id",required=true)int deposite_Order_id) {
        return deposite_OrderService.queryDeposite_Order(deposite_Order_id);
    }
    @PutMapping("/modifyDeposite_Order")
    @ApiOperation("根据押金订单id更新押金订单")
    public Result modifyDeposite_OrderById(@RequestBody @ApiParam(name="押金订单对象",value="传入json格式",required=true) Deposite_Order deposite_Order) {
        return deposite_OrderService.modifyDeposite_Order(deposite_Order);
    }

    @DeleteMapping("/dropDeposite_Order/{deposite_Order_id}")
    @ApiOperation("根据押金订单id删除押金订单")
    public Result dropDeposite_OrderById(@RequestBody @ApiParam(name="押金订单id",required=true) int deposite_Order_id) {
        return deposite_OrderService.dropDeposite_Order(deposite_Order_id);
    }
    @GetMapping("/queryUserDeposite_Order/{user_id}")
    @ApiOperation("根据用户id查询押金订单")
    public Result queryDeposite_OrderByUserId(@ApiParam(name="用户id",required=true)int user_id) {
        return deposite_OrderService.queryAllUserDeposite_Order(user_id);
    }
    @GetMapping("/queryMerDeposite_Order/{mer_id}")
    @ApiOperation("根据商户id查询押金订单")
    public Result queryDeposite_OrderByMerId(@ApiParam(name="商户id",required=true)int mer_id) {
        return deposite_OrderService.queryAllMerDeposite_Order(mer_id);
    }
    @GetMapping("/queryAllDeposite_Order")
    @ApiOperation("查询所有押金订单")
    public Result queryDeposite_OrderByMerId() {
        return deposite_OrderService.queryAllDeposite_Order();
    }


}
